package com.prs.crm.domain.doc;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import com.prs.crm.domain.FlowCodeEntity;

@Entity
@Table(name="doc_doctype")
public class DocType extends FlowCodeEntity{
	
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;
	private String name;
	private String doctypecode;
	@ManyToOne
	private DocType upType;
	@OneToMany(fetch=FetchType.LAZY,mappedBy="upType")
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
	private Set<DocType> childs;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public DocType getUpType() {
		return upType;
	}
	public void setUpType(DocType upType) {
		this.upType = upType;
	}
	public Set<DocType> getChilds() {
		return childs;
	}
	public void setChilds(Set<DocType> childs) {
		this.childs = childs;
	}
	public String getDoctypecode() {
		return doctypecode;
	}
	public void setDoctypecode(String doctypecode) {
		this.doctypecode = doctypecode;
	}
	public static long getSerialVersionUID() {
		return serialVersionUID;
	}
	
	
}
